<template>
  <div>
    <el-form ref="customerManageForm" :model="form" label-width="90px">
      <el-row>
        <el-col :md="7" :lg="6">
          <el-form-item label="客户姓名:">
            <el-input
              v-model="form.name"
              size="medium"
              placeholder="请输入客户姓名"
            />
          </el-form-item>
        </el-col>
        <el-col :md="7" :lg="6">
          <el-form-item label="客户电话:">
            <el-input
              v-model="form.tel"
              size="medium"
              placeholder="请输入客户电话"
            />
          </el-form-item>
        </el-col>
        <el-col :md="7" :lg="7">
          <el-form-item label="身份证号码:">
            <el-input
              v-model="form.idcard"
              size="medium"
              placeholder="请输入身份证号码"
            />
          </el-form-item>
        </el-col>
        <el-col :md="3" :lg="5" style="text-align: right">
          <el-button
            type="primary"
            size="medium"
            @click="onSubmit('customerManageForm')"
          >
            搜索
          </el-button>
        </el-col>
      </el-row>
      <el-form-item label="创建日期:">
        <el-date-picker
          v-model="form.ctime"
          type="date"
          size="medium"
          placeholder="请选择日期"
          format="yyyy-MM-dd"
          value-format="yyyy-MM-dd"
        />
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  name: 'CustomerManageForm',
  data() {
    return {
      form: {
        name: '',
        tel: '',
        idcard: '',
        ctime: ''
      }
    }
  },
  methods: {
    onSubmit(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          this.$emit('on-success-valid', {
            name: this.form.name,
            tel: this.form.tel,
            idcard: this.form.idcard,
            ctime: this.form.ctime
          })
        } else {
          return false
        }
      })
    }
  }
}
</script>

<style scoped>
</style>
